package TableCreate;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import oracle.jdbc.pool.OracleDataSource;

public class InsertBarangGudang {

    public static void main(String[] args) {
        String jdbcUrl = "jdbc:oracle:thin:@172.23.9.185:1521:orcl";
        String userid = "mhs115314034"; // gantikan dengan username anda
        String password = "mhs115314034"; // gantikan dengan password anda
//        String jdbcUrl = "jdbc:oracle:thin:@localhost:1521:xe";
//        String userid = "hr"; // gantikan dengan username anda
//        String password = "hr"; // gantikan dengan password anda

        try {
            Connection connection = null;
            OracleDataSource ds;
            ds = new OracleDataSource();
            ds.setURL(jdbcUrl);
            ds.setPassword(password);
            ds.setUser(userid);
            connection = (Connection) ds.getConnection();
            Statement statement = connection.createStatement();
            statement.executeQuery("insert into baranggudangt values ('0001','Aqua',1000,14000)");
            statement.executeQuery("insert into baranggudangt values ('0002','Oreo',500,2300)");
            statement.executeQuery("insert into baranggudangt values ('0003','Supermi',120,2000)");
            statement.executeQuery("insert into baranggudangt values ('0004','Milanta',300,7600)");
            statement.executeQuery("insert into baranggudangt values ('0005','mizone',300,5000)");
            statement.executeQuery("insert into baranggudangt values ('0006','indomie',1000,14000)");
            statement.executeQuery("insert into baranggudangt values ('0007','ades',500,2300)");
            statement.executeQuery("insert into baranggudangt values ('0008','blueband',120,2000)");
            statement.executeQuery("insert into baranggudangt values ('0009','nissin',300,7600)");
           
        } catch (SQLException e) {
// perform error handling here
            System.out.println("error :" + e.getMessage());
        }
    }
}
